# import functools
# class Solution(object):
#     def count(self, num1, num2, min_sum, max_sum):
#         base = 10 ** 9 + 7
#         n1 = len(num1)
#         n2 = len(num2)

#         @functools.cache
#         def calculate_count(left_count, left_val):
#             if left_count == 0:
#                 if left_val == 0:
#                     return 1
#                 else:
#                     return 0
#             else:
#                 if left_val < 0 or left_val > left_count * 9:
#                     return 0
#                 else:
#                     ans = 0
#                     for i in range(10):
#                         ans += calculate_count(left_count - 1, left_val - i)
#                     ans %= base
#                     return ans
                
#         @functools.cache
#         def dfs_large(i, now_val, n):
#             if i == n:
#                 if min_sum <= now_val <= max_sum:
#                     return 1
#                 else:
#                     return 0
#             else:

#                 ans = dfs_large(i + 1, now_val + int(num1[i]), n)
#                 for num in range(int(num1[i]) + 1, 10):
#                     next_val = now_val + num
#                     for total_val in range(min_sum - next_val, max_sum - next_val + 1):
#                         ans = (ans + calculate_count(n - i - 1, total_val)) % base
#                 return ans
                    
                
#         def dfs_small(i, now_val, n):
#             if i == n:
#                 if min_sum <= now_val <= max_sum:
#                     return 1
#                 else:
#                     return 0
#             else:
#                 ans = dfs_small(i + 1, now_val + int(num2[i]), n)
#                 for num in range(int(num2[i])):
#                     next_val = now_val + num
#                     for total_val in range(min_sum - next_val, max_sum - next_val + 1):
#                         ans = (ans + calculate_count(n - i - 1, total_val)) % base
#                 return ans                    


#         def dfs_equal(i, now_val, n):
#             if i == n:
#                 if min_sum <= now_val <= max_sum:
#                     return 1
#                 else:
#                     return 0
#             if num1[i] == num2[i]:
#                 now_val += int(num1[i])
#                 return dfs_equal(i + 1, now_val, n)
#             else:
#                 ans = 0
#                 for num in range(int(num1[i]) + 1, int(num2[i])):
#                     next_val = now_val + num
#                     for total_num in range(min_sum - next_val, max_sum - next_val + 1):
#                         if total_num >= 0:
#                             ans = (ans + calculate_count(n - i - 1, total_num)) % base
#                 next_val = now_val + int(num1[i])
#                 ans = (ans + dfs_large(i + 1, next_val, n)) % base
#                 next_val = now_val + int(num2[i])
#                 ans = (ans + dfs_small(i + 1, next_val, n)) % base
#                 return ans
#         if n1 == n2:
#             return dfs_equal(0, 0, n1)
#         else:
#             ans = 0
#             ans = (ans + dfs_large(0, 0, n1)) % base
#             ans = (ans + dfs_small(1, int(num2[0]), n2)) % base
#             for num in range(1, int(num2[0])):
#                 next_val = num
#                 for total_val in range(min_sum - next_val, max_sum - next_val + 1):
#                     ans = (ans + calculate_count(n2 - 1, total_val)) % base
#             for n in range(n1 + 1, n2):
#                 for num in range(1, 10):
#                     next_val = num
#                     for total_val in range(min_sum - next_val, max_sum - next_val + 1):
#                         ans = (ans + calculate_count(n - 1, total_val)) % base
#             return ans

import functools
class Solution(object):
    def count(self, num1, num2, min_sum, max_sum):
        n1 = len(num1)
        n2 = len(num2)
        base = 10 ** 9 + 7
        @functools.cache
        def dfs(i, sum, is_limit, num):
            if sum > max_sum:
                return 0
            else:
                if i == len(num):
                    return sum >= min_sum
                else:
                    ans = 0
                    up = int(num[i]) if is_limit else 10
                    for val in range(up):
                        ans += dfs(i + 1, sum + val, False, num)
                    if is_limit:
                        ans += dfs(i + 1, sum + int(num[i]), True, num)
                    return ans % base
        return (dfs(0, 0, True, num2) - dfs(0, 0, True, num1) + int(min_sum <= sum(map(int, num1)) <= max_sum)) % base

# 数位DP写法
data = Solution()
# num1 = "6312"
# num2 = "9416"
# min_sum = 29 
# max_sum = 30
# print(data.count(num1, num2, min_sum, max_sum))
# num1 = "1"
# num2 = "12"
# min_sum = 1
# max_sum = 8
# print(data.count(num1, num2, min_sum, max_sum))
num1 = "120"
num2 = "231"
min_sum = 5
max_sum = 10
print(data.count(num1, num2, min_sum, max_sum))